package org.kfish.framework.util;

import com.google.gson.Gson;

public class JsonUtil {

	private static Gson gson = null;
	static {
		gson = new Gson();
	}
	public static String toJson(Object obj){
		
		return gson.toJson(obj);
	}
	
	@SuppressWarnings("unchecked")
	public static <T extends Object> T fromJson(String jsonStr,T obj){
		return  (T) gson.fromJson(jsonStr, obj.getClass());
	}
}
